package cn.zkdcloud.novel;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * novel summer
 *
 * @author zk
 * @version 2017/9/29
 */
@Data
public class Novel {

    /**
     * name of novel
     */
    private String novelName;

    /**
     * novel url
     * (find latest chapter in this)
     */
    private String novelUrl;

    /**
     * latest chapter
     */
    private Chapter latestChapter;

    @Getter
    @Setter
    public static class Chapter {
        /**
         * url of chapter
         */
        private String chapterUrl;

        /**
         * name of chapter
         */
        private String chapterName;

        /**
         * latest number of chapter
         */
        private Integer chapterNumber;

        /**
         * latest update date
         */
        private String chapterDate;

        @Override
        public boolean equals(Object obj) {
            return obj instanceof Chapter
                    && chapterUrl.equals(((Chapter) obj).getChapterUrl())
                    && chapterName.equals(((Chapter) obj).getChapterName())
                    && chapterNumber.equals(((Chapter) obj).getChapterNumber());
        }
    }
}
